package com.ai.study.controller;

import com.ai.study.service.OpenAiService;
import com.ai.study.utils.AiResult;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * open ai聊天接口
 *
 * @author wwei
 * @date 2025-02-23 23:07
 **/
@RestController
@RequestMapping("open-ai")
public class OpenAiController {

    @Autowired
    private OpenAiService openAiService;

    @PostMapping("chatTest")
    public AiResult<JSONObject> chatTest(@RequestBody JSONObject chat) {
       return AiResult.success(openAiService.chatByAcs(chat));
    }

}
